<?php
namespace Api\Controller;
use Think\Controller;
/**
 * huhaiqin
 * 20220324
 * 日志数据接口
 */
class LogController extends Controller{

    /**
     * 日志数据列表接口
     */
    public function getdata(){
        if($_REQUEST['api_table'] == '' || $_REQUEST['api_table'] != 0){
            C('api_table',true); //标注是apitable的接口返回
        }
        $p = $_REQUEST['page'] ? $_REQUEST['page'] : 1;
        $row = $_REQUEST['limit'] ? $_REQUEST['limit'] : 20;
        $m = D('Log');
        $query = '';
        if($_REQUEST['searchtype'] && $_REQUEST['keywords']){
            if($_REQUEST['searchtype'] == 'realname'){
                $query .= ' AND B.'.$_REQUEST['searchtype'].' like "%'.$_REQUEST['keywords'].'%"';
            }else{
                $query .= ' AND A.'.$_REQUEST['searchtype'].' like "%'.$_REQUEST['keywords'].'%"';
            }
        }

        $data = $m->_query($p,$row,$query);
        _apiReturn(1,'success',$data);
    }
}